import fetch from '@/api'

export function getBalance(params) {
    return fetch({
        method: 'get',
        url: `/balance`,
        params
    })
}

export function monthBalance(data) {
    return fetch({
        method: 'post',
        url: `/balance/accountMonth`,
        data
    })
}

export function getBalanceDetail(id) {
    return fetch({
        method: 'get',
        url: `/balance/${id}/detail`
    })
}

export function getAccountRange(accountMonth) {
    return fetch({
        method: 'get',
        url: `/balance/getAccountRange/${accountMonth}`
    })
}

// 装卸船小计
export function getBalanceShipSubtotal(id) {
    return fetch({
        method: 'get',
        url: `/balance/${id}/ship/subtotal`
    })
}

// 装卸船清单
export function getBalanceShipList(id, detailId) {
    return fetch({
        method: 'get',
        url: `/balance/${id}/ship/${detailId}`
    })
}

// 特殊理箱小计
export function getBalanceSpecialList(id, detailId) {
    return fetch({
        method: 'get',
        url: `/balance/${id}/special/subtotal`
    })
}

// 下载
export function downloadFile(id) {
    return fetch({
        method: 'get',
        url: `/balance/excel/${id}`,
        responseType: 'blob'
    })
}

export function getBalanceSpecialDetailList(data) {
    return fetch({
        method: 'post',
        url: `/balance/special/detail`,
        data
    })
}

// 汇总统计
export function getBalanceTotal(id) {
    return fetch({
        method: 'get',
        url: `/balance/${id}/total`

    })
}
// 汇总统计打印
export function getBalanceTotalPrint(id) {
    return fetch({
        method: 'get',
        url: `balance/${id}/total/report`

    })
}

// 汇总统计打印(月)
export function getOperationTotalReportByMonth(params) {
    return fetch({
        method: 'get',
        url: `balance/get/total/month/all`,
        params
    })
}

// 现结分页
export function getBalanceCash(params) {
    return fetch({
        method: 'get',
        url: `/balance/cash`,
        params
    })
}

// 现结查询
export function getBalanceCashId(id) {
    return fetch({
        method: 'get',
        url: `/balance/cash/${id}`
    })
}

// --- 作业计件 ---
// 港口日期班组统计-饼状图
export function getClassCountPie(params) {
    return fetch({
        method: 'get',
        url: `/workPiece/pie`,
        params
    })
}

// 港口日期班组统计-柱状图
export function getClassCountBar(params) {
    return fetch({
        method: 'get',
        url: `/workPiece/bar`,
        params
    })
}

// 港口日期班组统计
export function getClassCount(params) {
    return fetch({
        method: 'get',
        url: `/workPiece/port`,
        params
    })
}

// 作业班组统计
export function getClassCountList(params) {
    return fetch({
        method: 'get',
        url: `/workPiece/class`,
        params
    })
}

// 作业人员统计
export function getPersonCountList(params) {
    return fetch({
        method: 'get',
        url: `/workPiece/user`,
        params
    })
}


// 规则相关
// 规则分页
export function getRuleList(params) {
    return fetch({
        method: 'get',
        url: `/rule`,
        params
    })
}
// 规则详情
export function getRuleId(id) {
    return fetch({
        method: 'get',
        url: `/rule/${id}/detail`,
    })
}
// 费率详情
export function getRuleIdRate(id) {
    return fetch({
        method: 'get',
        url: `/rule/${id}/rate`,
    })
}
// 设置费率
export function setRuleIdRate(id,data) {
    return fetch({
        method: 'put',
        url: `/rule/${id}/rate`,
        data
    })
}
export function deleteRule(id) {
    return fetch({
        method: 'delete',
        url: `/rule/${id}`,
    })
}
// 新增规则
export function addRuleList(data) {
    return fetch({
        method: 'post',
        url: `/rule`,
        data
    })
}
// 编辑规则
export function editRuleList(id,data) {
    return fetch({
        method: 'put',
        url: `/rule/${id}`,
        data
    })
}

// 获取规则条件
export function getRuleRuleList(params) {
    return fetch({
        method: 'get',
        url: `/rule/ruleList`,
        params
    })
}

// 根据规则代码查询值
export function getRuleCodeValue(params) {
    return fetch({
        method: 'get',
        url: `/rule/data`,
        params
    })
}

// 外理结算日历
export function getBalanceMonth(params) {
    return fetch({
        method:'get',
        url:`/balance/month`,
        params
    })
}

// 现结日历
export function getBalanceMonthCash(params) {
    return fetch({
        method:'get',
        url:`/balance/month/cash`,
        params
    })
}

// 计件月历
export function getWorkPieceMonth(params) {
    return fetch({
        method:'get',
        url:`/workPiece/month`,
        params
    })
}

export function getWorkPieceDay(params) {
    return fetch({
        method:'get',
        url:`/workPiece/day`,
        params
    })
}

export function printBalance(params) {
    return fetch({
        method:'get',
        url:`/printing/accountBill`,
        params
    })
}

// 计件月历-万州
export function getWorkPieceMonthWz(params) {
    return fetch({
        method:'get',
        url:`/wz/workPiece/month`,
        params
    })
}
//万州
export function getWorkPieceDayWz(params) {
    return fetch({
        method:'get',
        url:`/wz/workPiece/day`,
        params
    })
}

// 万州-作业班组统计
export function wzWorkTeam(params) {
    return fetch({
        method:'get',
        url:`/wz/workPiece/workTeam/`,
        params
    })
}
// 万州-作业人员统计
export function wzWorkTeamUserName(params) {
    return fetch({
        method:'get',
        url:`/wz/workPiece/workTeam/userName`,
        params
    })
}
// 作业计件明细
export function wzWorkTeamDetail(params) {
    return fetch({
        method:'get',
        url:`/wz/workPiece/workTeam/detail`,
        params
    })
}

// 动态查询
export function variableSearch(url,params) {
    return fetch({
        method:'get',
        url,
        params
    })
}

// 新增调账
export function addOrChangeAccount(data) {
    return fetch({
        method: 'post',
        url: `/balance/addOrChangeAccount`,
        data
    })
}

export function getChangeAccountBill(id) {
    return fetch({
        method: 'get',
        url: `/balance/getChangeAccountBill/${id}`,
    })
}
